package com.ekuaitu.kuaitu.activity;

import android.os.Bundle;
import android.widget.TextView;

import com.ekuaitu.kuaitu.R;
import com.ekuaitu.kuaitu.base.BaseActivity;
import com.ekuaitu.kuaitu.bean.MyCardBean;
import com.ekuaitu.kuaitu.utils.StatusBarUtil;
import com.ekuaitu.kuaitu.utils.TimeUtils;

import java.text.DecimalFormat;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MyCardDetailActivity extends BaseActivity {
    @BindView(R.id.card_brand)
    TextView cardBrand;
    @BindView(R.id.card_city)
    TextView cardCity;
    @BindView(R.id.card_face_value)
    TextView cardFaceValue;
    @BindView(R.id.card_date_from)
    TextView cardDateFrom;
    @BindView(R.id.card_date_end)
    TextView cardDateEnd;
    @BindView(R.id.card_code)
    TextView cardCode;
    @BindView(R.id.card_address)
    TextView cardAddress;
    @BindView(R.id.card_tips)
    TextView cardTips;
    private MyCardBean.AttachmentBean.CardCouponModelsBean cardCouponModelsBean;

    @Override
    public int getLayoutId() {
        return R.layout.activity_my_card_detail;
    }


    @Override
    public void initData() {
        super.initData();
        cardCouponModelsBean = (MyCardBean.AttachmentBean.CardCouponModelsBean) getIntent().getSerializableExtra("cardDetail");
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary), 0, false);
        DecimalFormat df = new DecimalFormat("0");
        cardFaceValue.setText( df.format(cardCouponModelsBean.getDenomination()));
        cardBrand.setText(cardCouponModelsBean.getBusinessName());
        cardCity.setText(cardCouponModelsBean.getAreaName());
        cardDateFrom.setText(TimeUtils.getFormatDate(cardCouponModelsBean.getStartDate(), "yyyy.MM.dd"));
        cardDateEnd.setText(TimeUtils.getFormatDate(cardCouponModelsBean.getEndDate(), "yyyy.MM.dd"));
        cardCode.setText(cardCouponModelsBean.getCode());
        cardAddress.setText(cardCouponModelsBean.getBusinessAddress());
        cardTips.setText(cardCouponModelsBean.getContent());
    }

    @OnClick(R.id.iv_card_return)
    public void onViewClicked() {
        finish();
    }
}
